<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="../../Templates/SubFolderTemplate.xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core">
    <ui:define name="head-title">
        <title>Edit Employee | Merlion's ERP System</title>
    </ui:define>
    
    <ui:define name="content">
        
        <f:view beforePhase="#{editEmployeeManagerBean.initView}">
        
        <h:form>
                               
            <p:panel id="panel" header="Edit Employee"> 
                <p:ajaxStatus style="width:16px;height:16px;">   
                    <f:facet name="start">   
                        <p:graphicImage value="http://www.primefaces.org:8080/showcase/design/ajaxloading.gif" /> 
                    </f:facet> 
 
                    <f:facet name="complete">   
                        <h:outputText value="" />   
                    </f:facet>   
                </p:ajaxStatus> 
 
                <p:messages /> 
 
                <h:panelGrid columns="3" cellpadding="10"> 
                    
                    <h:outputLabel for="employeeId" style="font-weight: bold" value="Employee Id: " /> 
                    <h:outputText id="employeeId" value ="#{editEmployeeManagerBean.employeeToEdit.employeeId}"/>
                    <br/> 
                    
                    <h:outputLabel for="employeeUserName" style="font-weight: bold" value="Employee UserName: " /> 
                    <h:outputText id="employeeUserName" value="#{editEmployeeManagerBean.employeeToEdit.userName}" />   
                    <br/> 
                    
                    <h:outputLabel for="employeeName" style="font-weight: bold" value="Employee Name: " /> 
                    <p:inputText value="#{editEmployeeManagerBean.employeeToEdit.employeeName}" required="true" label="Employee Name" requiredMessage="Employee Name is required." id="employeeName">                      
                    </p:inputText> 
                    <p:message for="employeeName" /> 
                    
                    <h:outputLabel for="NRIC" style="font-weight: bold" value="NRIC: " /> 
                    <p:inputText required="true" label="NRIC" requiredMessage="NRIC is required." id="NRIC" value="#{editEmployeeManagerBean.employeeToEdit.employeeNRIC}" validator="#{editEmployeeManagerBean.validateNRIC}"> 
                        
                    </p:inputText> 
                    <p:message for="NRIC" /> 
 
                    <h:outputLabel for="email" style="font-weight: bold" value="Email: " /> 
                    <p:inputText required="true" label="email" requiredMessage="Email is required." id="email" value="#{editEmployeeManagerBean.employeeToEdit.employeeEmail}" validator="#{editEmployeeManagerBean.validateEmail}"> 
                        
                    </p:inputText> 
                    <p:message for="email" /> 
                    
                    <h:outputLabel for="address" style="font-weight: bold" value="Address: " /> 
                    <p:inputText required="true" label="address" requiredMessage="Address is required." id="address" value="#{editEmployeeManagerBean.employeeToEdit.employeeAddress}"> 
                        
                    </p:inputText> 
                    <p:message for="address" /> 
                    
                    <h:outputLabel for="contactNumber" style="font-weight: bold" value="Contact Number: " /> 
                    <p:inputText required="true" label="contactNumber" requiredMessage="contact Number is required." id="contactNumber" value="#{editEmployeeManagerBean.employeeToEdit.employeeContactNumber}" validator="#{editEmployeeManagerBean.validateContactNumber}">
                        
                    </p:inputText> 
                    <p:message for="contactNumber" /> 
                    
                    <h:outputLabel for="attempt" style="font-weight: bold" value="Attempt: " /> 
                    <p:inputText required="true" label="attempt" requiredMessage="Attempt is required." id="attempt" value="#{editEmployeeManagerBean.employeeToEdit.attempt}" validator="#{editEmployeeManagerBean.validateAttemp}"> 
                    </p:inputText> 
                    <p:message for="attempt" /> 
                    
                    <h:outputLabel for="activatedStatus" style="font-weight: bold" value="Activated Status: " /> 
                    <h:selectOneRadio value="#{editEmployeeManagerBean.activatedStatusStr}" id="activatedStatus" >
                        <f:selectItem itemLabel="Activate" itemValue="activate"/>  
                        <f:selectItem itemLabel="Deactivate" itemValue="deactivate"/>
                    </h:selectOneRadio>
                    
                </h:panelGrid>                
                <p:commandButton id="btn" value="Update Employee" update="panel" actionListener="#{editEmployeeManagerBean.updateExistingEmployee}" ajax="true" />
                <p:commandButton id="restbtn" value="Reset Password" update="panel" actionListener="#{editEmployeeManagerBean.resetPassword(event)}" ajax="true" />
            </p:panel> 
        </h:form>
            
        </f:view>
    </ui:define>

</ui:composition>
